package com.ewhome.apartment.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewhome.apartment.R;
import com.ewhome.apartment.app.ImageConfigImpl;
import com.ewhome.apartment.mvp.model.entity.res.ResHomeBean;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.utils.ArmsUtils;
import java.util.List;

/**
 * author:zhangjing
 * 作用:
 * return:
 */

public class ApartmentAdapter extends BaseQuickAdapter<ResHomeBean.ItemsEntity,BaseViewHolder>{

    public ApartmentAdapter(@Nullable List<ResHomeBean.ItemsEntity> data) {
        super(R.layout.item_apartment, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ResHomeBean.ItemsEntity item) {
        ImageLoader imageLoader= ArmsUtils.obtainAppComponentFromContext(mContext.getApplicationContext()).imageLoader();
        imageLoader.loadImage(mContext, ImageConfigImpl.builder()
                .url(item.getThumb())
                .imageView(helper.<ImageView>getView(R.id.iv_apartmentimg))
                .build());
        helper.<TextView>getView(R.id.tv_apartmentname).setText(item.getTitle());
        helper.<TextView>getView(R.id.tv_apartmentprice).setText(item.getRmb());

    }
}
